package umacis.lwuitcomponent.property;
import java.util.Hashtable;
import java.util.Vector;

import com.sun.lwuit.Button;
import com.sun.lwuit.Component;
import com.sun.lwuit.Container;
import com.sun.lwuit.Label;
import com.sun.lwuit.RadioButton;
import com.sun.lwuit.plaf.Style;
import com.sun.lwuit.util.Log;


public class PropertyAssigner implements Constants {
	private static PropertyAssigner instance = new PropertyAssigner();

	private Setter setter[] = new Setter[NUMBER_OF_PROPERTIES]; //[NUMBER_OF_PROPERTIES];    // = new Vector();
	
	public PropertyAssigner() {
		fillSetters();
	}
	
	public static PropertyAssigner getInstance() {
		return instance;
	}
	
	public void set(Component cmp, Property property) {
		setter[property.index].execute(cmp, property.parameter);
	}
	
	private void fillSetters() {
		
		setter[STYLE_bgColor] =  new Setter() { public void execute(Component cmp, int parameter) {
			((Component)cmp).getStyle().setBgColor(parameter); 
			
			//((Component)cmp).setScrollable(true);
			//Log.p(cmp.getClass().getName());
		} };;
		//filling up the rest with valid setters.. empty though
		for (int i = STYLE_bgColor+1; i < NUMBER_OF_PROPERTIES; i++) setter[i] = new Setter();
	}
	
	private class Setter
	{
		public void execute(Component cmp, int parameter) {	
			Log.p("not implemented", Log.DEBUG);
		}
		
	}

	public void applyProperties(Component cmp, Properties properties) {
		// TODO Auto-generated method stub
		
	}	
}

